<HTML>
<HEAD>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script language=javascript src="dialog.js"></script>

<script language=javascript>
document.write ("<link href='../language/" + AvailableLangs["Active"] + ".css' type='text/css' rel='stylesheet'>");
document.write ("<link href='dialog.css' type='text/css' rel='stylesheet'>");


var sType = URLParams["type"];
var sReturnFlag = URLParams["return"];
var sTitle = "";
var sUploadTitle = "";

var CacheFiles = new Object();
var sCurrCacheName = "";
var sCurrSortFlag = "nameasc";
var sCurrViewFlag = "thumbnail";
var sCurrSelectItemIndex="";
var sCurrSelectFileName="";


switch(sType){
case "image":
	sTitle = lang["DlgBrowseImage"];
	sUploadTitle = lang["DlgBrowseUploadImage"];
	break;
case "flash":
	sTitle = lang["DlgBrowseFlash"];
	sUploadTitle = lang["DlgBrowseUploadFlash"];
	break;
case "media":
	sTitle = lang["DlgBrowseMedia"];
	sUploadTitle = lang["DlgBrowseUploadMedia"];
	break;
default:
	sType = "file";
	sTitle = lang["DlgBrowseFile"];
	sUploadTitle = lang["DlgBrowseUploadFile"];
	break;
}


document.write("<title>" + lang["DlgBrowse"] + "(" + sTitle + ")</title>");


var oCurrSelected = null;
function doGetFile(s_FolderType, s_Dir, s_ReturnFlag, o_Span){
	if (oCurrSelected==o_Span){return;}

	var el_Img;
	if (oCurrSelected){
		el_Img = oCurrSelected.childNodes(0);
		el_Img.src = el_Img.src.replace(/diropen/g,"dirclose");
		oCurrSelected.childNodes(1).className = "nodetext";
	}

	oCurrSelected = o_Span;
	el_Img = oCurrSelected.childNodes(0);
	el_Img.src = el_Img.src.replace(/dirclose/g,"diropen");
	oCurrSelected.childNodes(1).className = "nodetextselected";

	if (CacheFiles[s_ReturnFlag]){
		sCurrCacheName = s_ReturnFlag;
		showFolderPath(s_FolderType, s_Dir);
		showFileList();
	}else{
		myIframe.location.replace("../"+config.ServerExt+"/browse."+config.ServerExt+"?action=file&type="+sType+"&dir="+s_Dir+"&style="+config.StyleName+"&cusdir="+config.CusDir+"&foldertype="+s_FolderType+"&returnflag="+s_ReturnFlag);
	}
}

function doGetFolder(){
	myIframe.location.replace("../"+config.ServerExt+"/browse."+config.ServerExt+"?action=folder&type="+sType+"&style="+config.StyleName+"&cusdir="+config.CusDir);
}

function setFolderList(a_Upload, a_ShareImage, a_ShareFlash, a_ShareMedia, a_ShareOther){
	var html;
	html = "<div class=node><img border=0 src='../sysimage/tree/root.gif' align=absmiddle><span class=nodetext>" + sTitle + "</span></div>";
	
	html += getFolderTree(a_Upload, false, "upload", sUploadTitle);

	switch(sType){
	case "image":
		html += getFolderTree(a_ShareImage, true, "shareimage", lang["DlgBrowseShareImage"]);
		break;
	case "flash":
		html += getFolderTree(a_ShareFlash, true, "shareflash", lang["DlgBrowseShareFlash"]);
		break;
	case "media":
		html += getFolderTree(a_ShareMedia, true, "sharemedia", lang["DlgBrowseShareMedia"]);
		break;
	default:
		html += getFolderTree(a_ShareImage, false, "shareimage", lang["DlgBrowseShareImage"]);
		html += getFolderTree(a_ShareFlash, false, "shareflash", lang["DlgBrowseShareFlash"]);
		html += getFolderTree(a_ShareMedia, false, "sharemedia", lang["DlgBrowseShareMedia"]);
		html += getFolderTree(a_ShareOther, true, "shareother", lang["DlgBrowseShareFile"]);
		break;
	}

	divFolder.innerHTML = html;
}


function getFolderTree(arr, b_LastRoot, s_FolderType, s_Title){
	var a_Line = new Array();
	var a_Dir = new Array();
	var html = "";

	var n_Len, s_FolderName, n_Indent, n_LevelLast, b_HasChild, n_MinusDiv, s_Dir, s_ImgLastRoot;
	if (b_LastRoot){
		s_ImgLastRoot = "blank.gif";
	}else{
		s_ImgLastRoot = "line.gif";
	}
	a_Line[0] = "<img border=0 src='../sysimage/tree/"+s_ImgLastRoot+"' align=absmiddle>";
	
	a_Dir[0] = "";
	n_Len = arr.length;
	if (n_Len>0){
		if (b_LastRoot){
			s_ImgLastRoot = "plus2.gif";
		}else{
			s_ImgLastRoot = "plus1.gif";
		}

		html += "<div class=node><img border=0 src='../sysimage/tree/"+s_ImgLastRoot+"' align=absmiddle onclick=\"doDisplayChild('nodediv_"+s_FolderType+"',this)\"><span onclick=\"doGetFile('"+s_FolderType+"','','span_"+s_FolderType+"',this)\"><img border=0 src='../sysimage/tree/dirclose.gif' align=absmiddle><span class=nodetext>"+s_Title+"</span></span></div>";
		html += "<div class=nodediv id='nodediv_"+s_FolderType+"' style='display:none'>";
		for (var i=0; i<n_Len; i++){
			s_FolderName = arr[i][0];
			n_Indent = arr[i][1];
			n_LevelLast = arr[i][2];
			b_HasChild = false;
			
			if ((i+1)<n_Len){
				if (arr[i+1][1]>n_Indent){
					b_HasChild = true;
				}
			}

			if (i>0){			
				if (n_Indent>arr[i-1][1]){
					html += "<div class=nodediv id='nodediv_"+s_FolderType+"_"+(i-1)+"' style='display:none'>";
				}

				n_MinusDiv = arr[i-1][1] - n_Indent;
				if (n_MinusDiv>0){
					for (var j=0; j<n_MinusDiv; j++){
						html += "</div>";
					}
				}
			}

			html += "<div class=node>";

			for (var j=0; j<n_Indent; j++){
				html += a_Line[j];
			}

			if (n_LevelLast==0){
				a_Line[n_Indent] = "<img border=0 src='../sysimage/tree/line.gif' align=absmiddle>";
				if (b_HasChild){
					html += "<img border=0 src='../sysimage/tree/plus1.gif' align=absmiddle onclick=\"doDisplayChild('nodediv_"+s_FolderType+"_"+i+"',this)\">";
				}else{
					html += "<img border=0 src='../sysimage/tree/branch1.gif' align=absmiddle>";
				}
			}else{
				a_Line[n_Indent] = "<img border=0 src='../sysimage/tree/blank.gif' align=absmiddle>";
				if (b_HasChild){
					html += "<img border=0 src='../sysimage/tree/plus2.gif' align=absmiddle onclick=\"doDisplayChild('nodediv_"+s_FolderType+"_"+i+"',this)\">";
				}else{
					html += "<img border=0 src='../sysimage/tree/branch2.gif' align=absmiddle>";
				}
			}
			
			a_Dir[n_Indent] = s_FolderName + "/";
			s_Dir = "";
			for (var j=0; j<n_Indent; j++){
				s_Dir += a_Dir[j+1];
			}


			html += "<span class=nodetext onclick=\"doGetFile('"+s_FolderType+"','"+s_Dir+"','span_"+s_FolderType+"_"+i+"',this)\"><img border=0 src='../sysimage/tree/dirclose.gif' align=absmiddle><span class=nodetext>"+s_FolderName+"</span></span>";
			html += "</div>";
		}

		n_MinusDiv = n_Indent - 1;
		if (n_MinusDiv>0){
			for (var j=0; j<n_MinusDiv; j++){
				html += "</div>";
			}
		}

		html += "</div>";
	}else{
		if (b_LastRoot){
			s_ImgLastRoot = "branch2.gif";
		}else{
			s_ImgLastRoot = "branch1.gif";
		}
		html += "<div class=node><img border=0 src='../sysimage/tree/"+s_ImgLastRoot+"' align=absmiddle onclick=\"doDisplayChild('nodediv_"+s_FolderType+"',this)\"><span onclick=\"doGetFile('"+s_FolderType+"','','span_"+s_FolderType+"',this)\"><img border=0 src='../sysimage/tree/dirclose.gif' align=absmiddle><span class=nodetext>"+s_Title+"</span></span></div>";
		html += "<div class=nodediv id='nodediv_"+s_FolderType+"' style='display:none'>";
		html += "</div>";
	}

	return html;
}

function setFileList(s_ReturnFlag, s_FolderType, s_Dir, a_File){
	CacheFiles[s_ReturnFlag] = a_File;
	sCurrCacheName = s_ReturnFlag;
	showFolderPath(s_FolderType, s_Dir);
	showFileList();
}

function showFileList(){
	sCurrSelectFileName = "";
	sCurrSelectItemIndex = "";

	if (sCurrCacheName==""){return;}

	var arr = CacheFiles[sCurrCacheName];
	var l = arr.length;
	if (l==0){
		divFile.innerHTML = "";
		return;
	}

	switch(sCurrSortFlag){
	case "nameasc":
		arr.sort(function(x,y){return x[0].localeCompare(y[0])});
		break;
	case "namedesc":
		arr.sort(function(x,y){return y[0].localeCompare(x[0])});
		break;
	case "sizeasc":
		arr.sort(function(x,y){return parseFloat(x[1])-parseFloat(y[1])});
		break;
	case "sizedesc":
		arr.sort(function(x,y){return parseFloat(y[1])-parseFloat(x[1])});
		break;
	case "typeasc":
		arr.sort(function(x,y){var s1=x[0].substr(x[0].lastIndexOf(".")+1);s1=s1+"          ";s1=s1.substr(0,10);s1=s1+x[0];var s2=y[0].substr(y[0].lastIndexOf(".")+1);s2=s2+"          ";s2=s2.substr(0,10);s2=s2+y[0];return s1.localeCompare(s2)});
		break;
	case "typedesc":
		arr.sort(function(x,y){var s1=y[0].substr(y[0].lastIndexOf(".")+1);s1=s1+"          ";s1=s1.substr(0,10);s1=s1+y[0];var s2=x[0].substr(x[0].lastIndexOf(".")+1);s2=s2+"          ";s2=s2.substr(0,10);s2=s2+x[0];return s1.localeCompare(s2)});
		break;
	case "timeasc":
		arr.sort(function(x,y){return x[2].localeCompare(y[2])});
		break;
	case "timedesc":
		arr.sort(function(x,y){return y[2].localeCompare(x[2])});
		break;
	}

	var html = "";
	var m,n;
	
	switch (sCurrViewFlag){
	case "detail":
		var s_CurrSortField, s_CurrSortWard;
		if (sCurrSortFlag){
			s_CurrSortField = sCurrSortFlag.substr(0,4);
			s_CurrSortWard = sCurrSortFlag.substr(4);	
		}else{
			s_CurrSortField = "name";
			s_CurrSortWard = "asc";
		}

		var s_ArrowImg="";
		var s_ArrowHtmlName="";
		var s_ArrowHtmlSize="";
		var s_ArrowHtmlType="";
		var s_ArrowHtmlTime="";

		if (s_CurrSortWard=="asc"){
			s_ArrowImg = "../sysimage/tree/arrowup.gif";
		}else{
			s_ArrowImg = "../sysimage/tree/arrowdown.gif";
		}
		s_ArrowImg = "&nbsp;<img border=0 align=absmiddle src='"+s_ArrowImg+"'>";
		if (s_CurrSortField=="name"){s_ArrowHtmlName=s_ArrowImg}
		if (s_CurrSortField=="size"){s_ArrowHtmlSize=s_ArrowImg}
		if (s_CurrSortField=="type"){s_ArrowHtmlType=s_ArrowImg}
		if (s_CurrSortField=="time"){s_ArrowHtmlTime=s_ArrowImg}

		html = "<table border=0 cellpadding=1 cellspacing=1 width='100%'>";
		html += "<tr style='BACKGROUND-COLOR: #f0f0f0'>"
			+"<td width='20' align=center>&nbsp;</td>"
			+"<td width='185' align=left onclick=\"doClickSort('name')\">"+lang["DlgBrowseSortName"]+s_ArrowHtmlName+"</td>"
			+"<td width='75' align=left onclick=\"doClickSort('type')\">"+lang["DlgBrowseSortType"]+s_ArrowHtmlType+"</td>"
			+"<td width='130' align=center onclick=\"doClickSort('time')\">"+lang["DlgBrowseSortTime"]+s_ArrowHtmlTime+"</td>"
			+"<td width='85' align=right onclick=\"doClickSort('size')\">"+lang["DlgBrowseSortSize"]+s_ArrowHtmlSize+"</td>"
			+"</tr>";
		for (var i=0; i<l; i++){
			html += "<tr align=center id='item_tr_"+i+"' onclick=\"doClickDetail('"+i+"')\" onmouseover=\"doMouseOverDetail('"+i+"')\" onmouseout=\"doMouseOutDetail('"+i+"')\">"
				+"<td><img border=0 src='../sysimage/icon16/"+getFilePic(arr[i][0])+"' align=absmiddle></td>"
				+"<td align=left id='item_filename_"+i+"'>"+arr[i][0]+"</td>"
				+"<td align=left>"+arr[i][0].substr(arr[i][0].lastIndexOf(".")+1)+"</td>"
				+"<td align=center>"+arr[i][2]+"</td>"
				+"<td align=right>"+arr[i][1]+"</td>"
				+"</tr>";
		}
		html += "</table>";

		break;
	case "thumbnail":
		html = "<table border=0 cellpadding=0 cellspacing=0 width='100%'>";
		for (var i=0; i<l; i++){
			m = (i+1) % 4;
			if (m==1){
				html += "<tr>";
			}
			html += "<td align=center valign=top width='25%'>"
				+"<table border=0 cellpadding=0 cellspacing=0 onclick=\"doClickThumbnail('"+i+"')\" style='table-layout:fixed;word-wrap:break-word;'><tr><td>"
					+"<table border=0 cellpadding=1 cellspacing=3 id='item_table_"+i+"'><tr><td bgcolor=#ffffff>"
						+"<table border=0 cellspacing=1 cellpadding=0 width=120 height=120 style='border:1px solid #808080; table-layout:fixed;word-wrap:break-word;'><tr><td align=center valign=middle>"+getThumbnailHTML(arr[i][0])+"</td></tr></table>"
					+"</td></tr></table>"
				+"</td></tr>"
				+"<tr><td align=center><span id='item_span_"+i+"'>"+arr[i][0]+"</span></td></tr>"
				+"</table>"
				+"</td>";
			if (m==0){
				html += "</tr>";
			}
		}
		if (m!=0){
			for (var i=0; i<(4-m); i++){
				html += "<td width='25%'></td>";
			}
			html += "</tr>";
		}

		html += "</table>";

		break;
	case "icon":
		html = "<table border=0 cellpadding=0 cellspacing=5 width='100%'>";
		for (var i=0; i<l; i++){
			m = (i+1) % 5;
			if (m==1){
				html += "<tr>";
			}
			html += "<td valign=top width='20%'>"
				+"<table border=0 cellpadding=0 cellspacing=1 onclick=\"doClickIcon('"+i+"')\" style='table-layout:fixed;'>"
				+"<tr><td align=center><img id='item_img_"+i+"' border=0 align=absmiddle src='../sysimage/icon32/"+getFilePic(arr[i][0])+"'></td></tr>"
				+"<tr><td align=center height=30 valign=top id='item_td_"+i+"' style='word-wrap:break-word;line-height:1'>"+arr[i][0]+"</td></tr>"
				+"</table>"
				+"</td>";
			if (m==0){
				html += "</tr>";
			}
		}
		if (m!=0){
			for (var i=0; i<(5-m); i++){
				html += "<td width='20%'></td>";
			}
			html += "</tr>";
		}

		html += "</table>";

		break;
	case "list":
		html = "<table border=0 cellpadding=0 cellspacing=3 width='100%'>";
		for (var i=0; i<l; i++){
			m = (i+1) % 3;
			if (m==1){
				html += "<tr>";
			}
			html += "<td valign=top width='33%' onclick=\"doClickList('"+i+"')\">"
				+"<table border=0 cellpadding=0 cellspacing=0 id='item_table_"+i+"'><tr><td><img border=0 align=absmiddle src='../sysimage/icon16/"+getFilePic(arr[i][0])+"'></td><td width=2></td><td id='item_td_"+i+"'>"+arr[i][0]+"</td></tr></table>"
				+"</td>";
			if (m==0){
				html += "</tr>";
			}
		}
		if (m!=0){
			for (var i=0; i<(3-m); i++){
				html += "<td width='33%'></td>";
			}
			html += "</tr>";
		}

		html += "</table>";

		break;
	}

	divFile.innerHTML = html;
}

function showFolderPath(s_FolderType, s_Dir){
	var s_BrowseDir = "";
	s_FolderType = s_FolderType.toLowerCase();
	switch(s_FolderType){
	case "upload":
		s_BrowseDir = config.StyleUploadDir;
		if (config.CusDir){
			s_BrowseDir += config.CusDir;
			if (s_BrowseDir.substr(s_BrowseDir.length-1)!="/"){
				s_BrowseDir += "/";
			}
		}
		break;
	case "shareimage":
		s_BrowseDir = "sharefile/image/";
		break;
	case "shareflash":
		s_BrowseDir = "sharefile/flash/";
		break;
	case "sharemedia":
		s_BrowseDir = "sharefile/media/";
		break;
	case "shareother":
		s_BrowseDir = "sharefile/other/";
		break;
	}
	s_BrowseDir += s_Dir;
	d_folderpath.innerHTML = s_BrowseDir;
}

function doClickDetail(s_Index){
	var elTR, elFileName;
	if (sCurrSelectItemIndex!=""){
		elTR = document.getElementById("item_tr_"+sCurrSelectItemIndex);
		elTR.className = "detailout";
	}

	elTR = document.getElementById("item_tr_"+s_Index);
	elTR.className = "detailselected";
	elFileName = document.getElementById("item_filename_"+s_Index);
	
	sCurrSelectFileName = elFileName.innerHTML;
	sCurrSelectItemIndex = s_Index;
}

function doMouseOverDetail(s_Index){
	if (sCurrSelectItemIndex==s_Index){
		return;
	}else{
		elTR = document.getElementById("item_tr_"+s_Index);
		elTR.className = "detailover";
	}
}

function doMouseOutDetail(s_Index){
	if (sCurrSelectItemIndex==s_Index){
		return;
	}else{
		elTR = document.getElementById("item_tr_"+s_Index);
		elTR.className = "detailout";
	}
}


function doClickIcon(s_Index){
	var elTD, elImg;
	if (sCurrSelectItemIndex!=""){
		elTD = document.getElementById("item_td_"+sCurrSelectItemIndex);
		elTD.className = "iconitem";
		elImg = document.getElementById("item_img_"+sCurrSelectItemIndex);
		elImg.style.filter = "";
	}

	elTD = document.getElementById("item_td_"+s_Index);
	elTD.className = "iconitemselected";
	elImg = document.getElementById("item_img_"+s_Index);
	elImg.style.filter = "gray";
	
	sCurrSelectFileName = elTD.innerText;
	sCurrSelectItemIndex = s_Index;
}

function doClickList(s_Index){
	var elTable, elTD;
	if (sCurrSelectItemIndex!=""){
		elTable = document.getElementById("item_table_"+sCurrSelectItemIndex);
		elTable.className = "listitem";
	}

	elTable = document.getElementById("item_table_"+s_Index);
	elTable.className = "listitemselected";
	elTD = document.getElementById("item_td_"+s_Index);
	sCurrSelectFileName = elTD.innerText;
	sCurrSelectItemIndex = s_Index;
}

function doClickThumbnail(s_Index){
	var elTable, elSpan;
	if (sCurrSelectItemIndex!=""){
		elTable = document.getElementById("item_table_"+sCurrSelectItemIndex);
		elTable.className = "thumbnailitem";
		elSpan = document.getElementById("item_span_"+sCurrSelectItemIndex);
		elSpan.className = "thumbnailitem";
	}

	elTable = document.getElementById("item_table_"+s_Index);
	elTable.className = "thumbnailitemselected";
	elSpan = document.getElementById("item_span_"+s_Index);
	elSpan.className = "thumbnailitemselected";
	
	sCurrSelectFileName = elSpan.innerHTML;
	sCurrSelectItemIndex = s_Index;
}

function getThumbnailHTML(s_FileName){
	var s_CurrPath = d_folderpath.innerHTML;
	if (s_CurrPath.substr(0,1)!="/"){
		s_CurrPath = "../" + s_CurrPath;
	}
	var s_TypePic = "../sysimage/icon16/" + getFilePic(s_FileName);
	var s_Ext = s_FileName.substr(s_FileName.lastIndexOf(".")+1).toLowerCase();
	var html = "";
	var s_Src = s_CurrPath+s_FileName;
	if ((s_Ext=="gif")||(s_Ext=="jpg")||(s_Ext=="jpeg")||(s_Ext=="bmp")||(s_Ext=="png")){
		html = "<img border=0 src='"+s_Src+"' onload='doThumbnailLoad(this)'>";
	}else if (s_Ext=="swf"){
		html = getFlashCode(s_Src, 115, 115);
	}else{
		html = "<img border=0 src='"+s_TypePic+"' style='position:relative;left:50px;top:50px'>";
	}
	return html
}

function getFlashCode(url, w, h) {
	var str = '<object width="'+ w +'" height="'+ h +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0">'
		+ '<param name="movie" value="'+ url +'">'
		+ '<param name="wmode" value="opaque">'
		+ '<param name="quality" value="autohigh">'
		+ '<embed width="'+ w +'" height="'+ h +'" src="'+ url +'" quality="autohigh" wmode="opaque" type="application/x-shockwave-flash" plugspace="http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash"></embed>'
		+ '</object>';
	return str;
}

function doThumbnailLoad(el){
	var w = el.width;
	var h = el.height;
	var bw = 115;
	var bh = 115;
	var sw,sh;

	if ((w>bw)||(h>bh)){
		var nw = bw/w;
		var nh = bh/h;
		if (nw>nh){
			sh = bh;
			sw = w*nh;
		}else{
			sw = bw;
			sh = h*nw;
		}
	}else{
		sw = w;
		sh = h;
	}
	
	el.style.width = sw;
	el.style.height = sh;
}

function doChangeView(){
	sCurrViewFlag = d_view.options[d_view.selectedIndex].value;
	showFileList();
}

function doChangeSort(){
	sCurrSortFlag = d_sort.options[d_sort.selectedIndex].value + d_sortward.options[d_sortward.selectedIndex].value;
	showFileList();
}

function doClickSort(flag){
	var s_CurrSortField = sCurrSortFlag.substr(0,4);
	var s_CurrSortWard = sCurrSortFlag.substr(4);

	var s_SortField = flag;
	var s_SortWard = "";

	if (flag==s_CurrSortField){
		if (s_CurrSortWard=="desc"){
			s_SortWard = "asc";
		}else{
			s_SortWard = "desc";
		}
	}else{
		s_SortWard = "asc"
	}

	SearchSelectValue(d_sort, s_SortField);
	SearchSelectValue(d_sortward, s_SortWard);

	sCurrSortFlag = s_SortField + s_SortWard;
	showFileList();
}

function doDisplayChild(s,o){
	var el = document.getElementById(s);
	if (el.style.display == "none"){
		el.style.display = "";
		o.src = o.src.replace(/plus/g, "minus");
	}else{
		el.style.display = "none";
		o.src = o.src.replace(/minus/g, "plus");
	}
}

function getFilePic(url){
	var sExt;
	sExt=url.substr(url.lastIndexOf(".")+1);
	sExt=sExt.toUpperCase();
	var sPicName;
	switch(sExt){
	case "TXT":
		sPicName = "txt.gif";
		break;
	case "CHM":
		sPicName = "chm.gif";
		break;
	case "HLP":
		sPicName = "hlp.gif";
		break;
	case "DOC":
		sPicName = "doc.gif";
		break;
	case "PDF":
		sPicName = "pdf.gif";
		break;
	case "MDB":
		sPicName = "mdb.gif";
		break;
	case "GIF":
		sPicName = "gif.gif";
		break;
	case "JPG":
	case "JPEG":
		sPicName = "jpg.gif";
		break;
	case "BMP":
		sPicName = "bmp.gif";
		break;
	case "PNG":
		sPicName = "png.gif";
		break;
	case "ICO":
		sPicName = "ico.gif";
		break;
	case "ASP":
	case "JSP":
	case "PHP":
	case "PHP3":
		sPicName = "code.gif";
		break;
	case "JS":
	case "VBS":
		sPicName = "js.gif";
		break;
	case "ASPX":
		sPicName = "aspx.gif";
		break;
	case "XML":
		sPicName = "xml.gif";
		break;
	case "HTM":
	case "HTML":
	case "SHTML":
		sPicName = "htm.gif";
		break;
	case "ZIP":
		sPicName = "zip.gif";
		break;
	case "RAR":
		sPicName = "rar.gif";
		break;
	case "EXE":
		sPicName = "exe.gif";
		break;
	case "AVI":
		sPicName = "avi.gif";
		break;
	case "MPG":
	case "MPEG":
	case "ASF":
		sPicName = "mp.gif";
		break;
	case "RA":
	case "RM":
		sPicName = "rm.gif";
		break;
	case "MP3":
		sPicName = "mp3.gif";
		break;
	case "MID":
	case "MIDI":
		sPicName = "mid.gif";
		break;
	case "WAV":
		sPicName = "audio.gif";
		break;
	case "XLS":
		sPicName = "xls.gif";
		break;
	case "PPT":
	case "PPS":
		sPicName = "ppt.gif";
		break;
	case "SWF":
		sPicName = "swf.gif";
		break;
	default:
		sPicName = "unknow.gif";
		break;
	}
	return sPicName;

}

function ok(){
	if (!sCurrSelectFileName){
		alert(lang["DlgBrowseNoSelected"]);
		return;
	}

	var url = relativePath2setPath(d_folderpath.innerHTML + sCurrSelectFileName);
	if (sReturnFlag=="input"){
		window.returnValue = url;
	}else{
		var html;
		switch(sType){
		case "image":
			html = "<img id='eWebEditor_TempElement_Img' border=0 src='"+url+"'>";
			dialogArguments.insertHTML(html);
			var oTempElement = dialogArguments.eWebEditor.document.getElementById("eWebEditor_TempElement_Img");
			oTempElement.src = url;
			oTempElement.removeAttribute("id");
			break;
		case "flash":
			html = getFlashCode(url, 200, 200);
			dialogArguments.insertHTML(html);
			break;
		case "media":
			html = '<EMBED src="' + url + '" width="200" height="200" type="audio/x-pn-realaudio-plugin" autostart="true" controls="IMAGEWINDOW,ControlPanel,StatusBar" console="Clip1"></EMBED>';
			dialogArguments.insertHTML(html);
			break;
		default:
			var s_FilePic = getFilePic(sCurrSelectFileName);
			var s_PicSrc = relativePath2setPath("sysimage/icon16/"+s_FilePic);
			dialogArguments.insertHTML("<img id=eWebEditor_TempElement_Img border=0 src='"+s_PicSrc+"'><a id=eWebEditor_TempElement_Href href='"+url+"' target=_blank>"+sCurrSelectFileName+"</a>");

			var oTempElement = dialogArguments.eWebEditor.document.getElementById("eWebEditor_TempElement_Img");
			oTempElement.src = s_PicSrc;
			oTempElement.removeAttribute("id");
			
			oTempElement = dialogArguments.eWebEditor.document.getElementById("eWebEditor_TempElement_Href");
			oTempElement.href = url;
			oTempElement.removeAttribute("id");
			break;
		}
		window.returnValue = null;
	}
	window.close();
}

function InitDocument(){
	AvailableLangs.TranslatePage(document);

	adjustDialog();
	doGetFolder();
}

</script>

<style>
div.nodediv {padding:0px;margin:0px;WHITE-SPACE: nowrap;}
div.node {padding:0px;margin:0px;WHITE-SPACE: nowrap;}
.nodetext {color:#000000;background-color:#ffffff}
.nodetextselected {color:#ffffff;background-color:#0A246A}
.thumbnailitem {color:#000000;background-color:#ffffff}
.thumbnailitemselected {color:#ffffff;background-color:#0A246A}
.listitem {color:#000000;background-color:#ffffff}
.listitemselected {color:#ffffff;background-color:#0A246A}
.iconitem {color:#000000;background-color:#ffffff}
.iconitemselected {color:#ffffff;background-color:#0A246A}

.detailout {}
.detailover {background-color:#eeeeee}
.detailover td {color:#000000;}
.detailselected {background-color:#0A246A}
.detailselected td {color:#ffffff;}
</style>

</HEAD>

<BODY onload="InitDocument()">
<table border=0 cellpadding=0 cellspacing=5 id=tabDialogSize><tr><td>

<table border=0 cellpadding=0 cellspacing=0 width="100%" align=center>
<tr><td>

<table border=0 cellpadding=0 cellspacing=0 width="" align=center>
<tr>
	<td noWrap width="20px"><IMG src="../sysimage/tree/folderopen.gif" border=0></td>
	<td noWrap width="100%"><SPAN id=d_folderpath>/</SPAN></td>
	<td noWrap width="" align="right">
		<table border=0 cellpadding=0 cellspacing=0>
		<tr>
			<td noWrap><span lang="DlgBrowseSort"></span>:</td>
			<td><select id=d_sort size=1 style="width:80px" onchange="doChangeSort()"><option value="name" lang="DlgBrowseSortName"><option value="size" lang="DlgBrowseSortSize"><option value="type" lang="DlgBrowseSortType"><option value="time" lang="DlgBrowseSortTime"></select></td>
			<td><select id=d_sortward size=1 style="width:50px" onchange="doChangeSort()"><option value="asc" lang="DlgBrowseSortASC"><option value="desc" lang="DlgBrowseSortDESC"></select></td>
			<td>&nbsp;</td>
			<td noWrap><span lang="DlgBrowseView"></span>:</td>
			<td><select id=d_view size=1 style="width:80px" onchange="doChangeView()"><option value="detail" lang="DlgBrowseViewDetails"><option value="thumbnail" lang="DlgBrowseViewThumbnails" selected><option value="icon" lang="DlgBrowseViewIcons"><option value="list" lang="DlgBrowseViewList"></select></td>
		</table>
	</td>
</tr>
</table>

</td></tr>
<tr><td>

<table border=0 cellpadding=0 cellspacing=0 align=center>
<tr>
<td vAlign=top noWrap>
	<DIV id=divFolder style="BORDER-RIGHT: 1.5pt inset; PADDING-RIGHT: 0px; BORDER-TOP: 1.5pt inset; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; OVERFLOW: auto; BORDER-LEFT: 1.5pt inset; WIDTH: 150px; PADDING-TOP: 0px; BORDER-BOTTOM: 1.5pt inset; HEIGHT: 350px; BACKGROUND-COLOR: white">
	
	</DIV>
</td>
<td width=10>&nbsp; </td>
<td vAlign=top>
	<DIV id=divFile style="BORDER-RIGHT: 1.5pt inset; PADDING-RIGHT: 0px; BORDER-TOP: 1.5pt inset; PADDING-LEFT: 0px; PADDING-BOTTOM: 0px; VERTICAL-ALIGN: top; OVERFLOW: auto; BORDER-LEFT: 1.5pt inset; WIDTH: 540px; PADDING-TOP: 0px; BORDER-BOTTOM: 1.5pt inset; HEIGHT: 350px; BACKGROUND-COLOR: white">
	
	</DIV>
</td>
</tr>
</table>

</td></tr>
<tr><td height=5></td></tr>
<tr><td noWrap align=right><input type=submit class="dlgBtnCommon" value='' id=Ok onclick="ok()" lang=DlgBtnOK>&nbsp;&nbsp;<input type=button class="dlgBtnCommon" value='' onclick="window.close();" lang=DlgBtnCancel></td></tr>

</td></tr></table>

<iframe id=myIframe src="" width="0" height="0" frameborder=0></iframe>

</BODY></HTML>